<!DOCTYPE html>
<html>
<#include "../head.html">
    <body class="full">
    <div class="mc">
        <div class="mc-l">
            <!--左侧导航---{-->
            <div id="navPanelContainer">
                <div class="system-logo cd"></div>
                <!--管理员信息---{-->
                <#include "../adminInfo.html">
                    <!--管理员信息---}-->
                    <div class="nav-wrap">
                        <#include "left.html">
                    </div>
            </div>
            <!--左侧导航---}-->
        </div>
        <div class="mc-m">
            <div class="navToggle"></div>
        </div>
        <div class="mc-r">
            <!--顶部导航---{-->
            <#include "../topNav.html">
                <!--顶部导航---}-->

                <!--面包屑导航---{-->
                <#assign moduleName="发送红包">
                    <#include "banner.html">
                        <!--面包屑导航---}-->

                        <!--工具栏--{-->
                        <div id="toolbar" class="clearfix">

                        </div>
                        <!--工具栏--}-->

                        <div id="main" align="center">
                            <form name="form1" method="post" action="/admin/redPacket/importVerifyCode.html" onsubmit="return checkfexecl();" autocomplete="off" enctype="multipart/form-data">
                                <div class="valBox w750">
                                    <div class="top">
                                        <strong>导入短信</strong>
                                    </div>
                                    <div class="val clearfix">
                                        <table align="center">
                                            <tr valign="middle">
                                                <th>
                                                    <font size='3' class="other-tool" style="line-height: 38px;">请选择数据源：</font>
                                                    <input class="input inputfile s_updateFile" type="file" id="fexecl" name="excelFile">
                                                    <label for="fexecl" class="s_updateFileLabel"><span>选择文件</span></label>
                                                </th>
                                                <th>
                                                    <input type="hidden"  name="actionType" value="import" />
                                                    <input class="submit s_import" type="submit" value="导入">
                                                </th>
                                            </tr>
                                        </table>
                                    </div>
                                </div>

                            </form>
                        </div>
        </div>
    </div>
    <div class="mc-b">
        <#include "../foot.html">
    </div>
    <#include "../jsPage.html">
    <script>
 // 允许上传的文件格式,用逗号隔开
	var sAllowExt = "xls";
	// 导入数据
	function checkfexecl() {
		// 获取文本域的值
		var fexecl = document.getElementById("fexecl").value;
		var excelName = fexecl;
		if (fexecl == "") {
			alert("请先选择数据源再点击导入！");
			return false;
		} else if (isType() == false) {
			alert("只能上传" + sAllowExt + "格式的文件！");
			return false;
		} else {
			return true;
		}
	}
	function isType() {
		// 获取文本域的值
		var url = document.getElementById("fexecl").value;
		var sTemp;
		var b = false;
		var s = sAllowExt.toUpperCase().split(",");
		for ( var i = 0; i < s.length; i++) {
			sTemp = url.substr(url.length - s[i].length - 1);
			sTemp = sTemp.toUpperCase();
			s[i] = "." + s[i];
			if (s[i] == sTemp) {
				b = true;
				break;
			}
		}
		return b;
	}
    </script>
        <script>
            var inputs = document.querySelectorAll( '.inputfile' );
            Array.prototype.forEach.call( inputs, function( input )
            {
                var label    = input.nextElementSibling,
                    labelVal = label.innerHTML;

                input.addEventListener( 'change', function( e )
                {
                    var fileName = '';
                    if(this.files && this.files.length > 1 )
                        fileName = (this.getAttribute('data-multiple-caption') || '')
                            .replace( '{count}', this.files.length );
                    else
                        fileName = e.target.value.split( '\\' ).pop();

                    if( fileName )
                        label.querySelector( 'span' ).innerHTML = fileName;
                    else
                        label.innerHTML = labelVal;
                });
            });
            </script>
    </body>
</html>